package gogtp

import "fmt"

type GTPAnalyze struct {
	conn      *Connection
	OnAnalyze func(string)
}

func (a *GTPAnalyze) OutputF(line string) {
	if a.OnAnalyze != nil {
		a.OnAnalyze(line)
	}
}

func (a *GTPAnalyze) ErrorF(string) {

}

// 创建命令行
func NewGTPAnalyze(conn *Connection) *GTPAnalyze {
	command := &GTPAnalyze{
		conn: conn,
	}
	return command
}

func (a *GTPAnalyze) Analyze(t int) error {
	cmd := fmt.Sprintf("lz-analyze %d", t)
	return a.conn.PostCommand(cmd, a)
}
func (a *GTPAnalyze) Stop() {
	_=a.conn.PostCommand("\n", nil)
}
